﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Terraria.ModLoader
{
	// Token: 0x020001EF RID: 495
	public class ModProjectile
	{
		// Token: 0x17000191 RID: 401
		// (get) Token: 0x06001546 RID: 5446 RVA: 0x00010752 File Offset: 0x0000E952
		// (set) Token: 0x06001547 RID: 5447 RVA: 0x0001075A File Offset: 0x0000E95A
		public Projectile projectile { get; internal set; }

		// Token: 0x17000192 RID: 402
		// (get) Token: 0x06001548 RID: 5448 RVA: 0x00010763 File Offset: 0x0000E963
		// (set) Token: 0x06001549 RID: 5449 RVA: 0x0001076B File Offset: 0x0000E96B
		public Mod mod { get; internal set; }

		// Token: 0x17000193 RID: 403
		// (get) Token: 0x0600154A RID: 5450 RVA: 0x00010774 File Offset: 0x0000E974
		// (set) Token: 0x0600154B RID: 5451 RVA: 0x0001077C File Offset: 0x0000E97C
		public string Name { get; internal set; }

		// Token: 0x17000194 RID: 404
		// (get) Token: 0x0600154C RID: 5452 RVA: 0x00010785 File Offset: 0x0000E985
		// (set) Token: 0x0600154D RID: 5453 RVA: 0x0001078D File Offset: 0x0000E98D
		public ModTranslation DisplayName { get; internal set; }

		// Token: 0x17000195 RID: 405
		// (get) Token: 0x0600154E RID: 5454 RVA: 0x00010796 File Offset: 0x0000E996
		public virtual string Texture
		{
			get
			{
				return (base.GetType().Namespace + "." + this.Name).Replace('.', '/');
			}
		}

		// Token: 0x0600154F RID: 5455 RVA: 0x000107BC File Offset: 0x0000E9BC
		public ModProjectile()
		{
			this.projectile = new Projectile();
			this.projectile.modProjectile = this;
		}

		// Token: 0x06001550 RID: 5456 RVA: 0x000107E2 File Offset: 0x0000E9E2
		public virtual bool Autoload(ref string name)
		{
			return this.mod.Properties.Autoload;
		}

		// Token: 0x17000196 RID: 406
		// (get) Token: 0x06001551 RID: 5457 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual bool CloneNewInstances
		{
			get
			{
				return false;
			}
		}

		// Token: 0x06001552 RID: 5458 RVA: 0x000107F4 File Offset: 0x0000E9F4
		public virtual ModProjectile Clone()
		{
			return (ModProjectile)base.MemberwiseClone();
		}

		// Token: 0x06001553 RID: 5459 RVA: 0x00413F48 File Offset: 0x00412148
		public virtual ModProjectile NewInstance(Projectile projectileClone)
		{
			if (this.CloneNewInstances)
			{
				ModProjectile modProjectile = this.Clone();
				modProjectile.projectile = projectileClone;
				return modProjectile;
			}
			ModProjectile modProjectile2 = (ModProjectile)Activator.CreateInstance(base.GetType());
			modProjectile2.projectile = projectileClone;
			modProjectile2.mod = this.mod;
			modProjectile2.Name = this.Name;
			modProjectile2.aiType = this.aiType;
			modProjectile2.cooldownSlot = this.cooldownSlot;
			modProjectile2.drawOffsetX = this.drawOffsetX;
			modProjectile2.drawOriginOffsetY = this.drawOriginOffsetY;
			modProjectile2.drawOriginOffsetX = this.drawOriginOffsetX;
			modProjectile2.drawHeldProjInFrontOfHeldItemAndArms = this.drawHeldProjInFrontOfHeldItemAndArms;
			return modProjectile2;
		}

		// Token: 0x06001554 RID: 5460 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SetDefaults()
		{
		}

		// Token: 0x06001555 RID: 5461 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SetStaticDefaults()
		{
		}

		// Token: 0x06001556 RID: 5462 RVA: 0x00413FE8 File Offset: 0x004121E8
		public virtual void AutoStaticDefaults()
		{
			Main.projectileTexture[this.projectile.type] = ModLoader.GetTexture(this.Texture);
			Main.projFrames[this.projectile.type] = 1;
			if (this.projectile.hostile)
			{
				Main.projHostile[this.projectile.type] = true;
			}
			if (this.projectile.aiStyle == 7)
			{
				Main.projHook[this.projectile.type] = true;
			}
			if (this.DisplayName.IsDefault())
			{
				this.DisplayName.SetDefault(Regex.Replace(this.Name, "([A-Z])", " $1").Trim());
			}
		}

		// Token: 0x06001557 RID: 5463 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool PreAI()
		{
			return true;
		}

		// Token: 0x06001558 RID: 5464 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void AI()
		{
		}

		// Token: 0x06001559 RID: 5465 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void PostAI()
		{
		}

		// Token: 0x0600155A RID: 5466 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SendExtraAI(BinaryWriter writer)
		{
		}

		// Token: 0x0600155B RID: 5467 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ReceiveExtraAI(BinaryReader reader)
		{
		}

		// Token: 0x0600155C RID: 5468 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool ShouldUpdatePosition()
		{
			return true;
		}

		// Token: 0x0600155D RID: 5469 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough)
		{
			return true;
		}

		// Token: 0x0600155E RID: 5470 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool OnTileCollide(Vector2 oldVelocity)
		{
			return true;
		}

		// Token: 0x0600155F RID: 5471 RVA: 0x00404F84 File Offset: 0x00403184
		public virtual bool? CanCutTiles()
		{
			return null;
		}

		// Token: 0x06001560 RID: 5472 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void CutTiles()
		{
		}

		// Token: 0x06001561 RID: 5473 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool PreKill(int timeLeft)
		{
			return true;
		}

		// Token: 0x06001562 RID: 5474 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void Kill(int timeLeft)
		{
		}

		// Token: 0x06001563 RID: 5475 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool CanDamage()
		{
			return true;
		}

		// Token: 0x06001564 RID: 5476 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual bool MinionContactDamage()
		{
			return false;
		}

		// Token: 0x06001565 RID: 5477 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ModifyDamageHitbox(ref Rectangle hitbox)
		{
		}

		// Token: 0x06001566 RID: 5478 RVA: 0x00404F84 File Offset: 0x00403184
		public virtual bool? CanHitNPC(NPC target)
		{
			return null;
		}

		// Token: 0x06001567 RID: 5479 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
		{
		}

		// Token: 0x06001568 RID: 5480 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void OnHitNPC(NPC target, int damage, float knockback, bool crit)
		{
		}

		// Token: 0x06001569 RID: 5481 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool CanHitPvp(Player target)
		{
			return true;
		}

		// Token: 0x0600156A RID: 5482 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ModifyHitPvp(Player target, ref int damage, ref bool crit)
		{
		}

		// Token: 0x0600156B RID: 5483 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void OnHitPvp(Player target, int damage, bool crit)
		{
		}

		// Token: 0x0600156C RID: 5484 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool CanHitPlayer(Player target)
		{
			return true;
		}

		// Token: 0x0600156D RID: 5485 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
		{
		}

		// Token: 0x0600156E RID: 5486 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void OnHitPlayer(Player target, int damage, bool crit)
		{
		}

		// Token: 0x0600156F RID: 5487 RVA: 0x00404F84 File Offset: 0x00403184
		public virtual bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
		{
			return null;
		}

		// Token: 0x06001570 RID: 5488 RVA: 0x00404FFC File Offset: 0x004031FC
		public virtual Color? GetAlpha(Color lightColor)
		{
			return null;
		}

		// Token: 0x06001571 RID: 5489 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool PreDrawExtras(SpriteBatch spriteBatch)
		{
			return true;
		}

		// Token: 0x06001572 RID: 5490 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
		{
			return true;
		}

		// Token: 0x06001573 RID: 5491 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void PostDraw(SpriteBatch spriteBatch, Color lightColor)
		{
		}

		// Token: 0x06001574 RID: 5492 RVA: 0x00404F84 File Offset: 0x00403184
		public virtual bool? CanUseGrapple(Player player)
		{
			return null;
		}

		// Token: 0x06001575 RID: 5493 RVA: 0x00404F84 File Offset: 0x00403184
		public virtual bool? SingleGrappleHook(Player player)
		{
			return null;
		}

		// Token: 0x06001576 RID: 5494 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void UseGrapple(Player player, ref int type)
		{
		}

		// Token: 0x06001577 RID: 5495 RVA: 0x00010801 File Offset: 0x0000EA01
		public virtual float GrappleRange()
		{
			return 300f;
		}

		// Token: 0x06001578 RID: 5496 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void NumGrappleHooks(Player player, ref int numHooks)
		{
		}

		// Token: 0x06001579 RID: 5497 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void GrappleRetreatSpeed(Player player, ref float speed)
		{
		}

		// Token: 0x0600157A RID: 5498 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void GrapplePullSpeed(Player player, ref float speed)
		{
		}

		// Token: 0x0600157B RID: 5499 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void DrawBehind(int index, List<int> drawCacheProjsBehindNPCsAndTiles, List<int> drawCacheProjsBehindNPCs, List<int> drawCacheProjsBehindProjectiles, List<int> drawCacheProjsOverWiresUI)
		{
		}

		// Token: 0x040014EC RID: 5356
		public int aiType;

		// Token: 0x040014ED RID: 5357
		public int cooldownSlot = -1;

		// Token: 0x040014EE RID: 5358
		public int drawOffsetX;

		// Token: 0x040014EF RID: 5359
		public int drawOriginOffsetY;

		// Token: 0x040014F0 RID: 5360
		public float drawOriginOffsetX;

		// Token: 0x040014F1 RID: 5361
		public bool drawHeldProjInFrontOfHeldItemAndArms;
	}
}
